package com.neusoft.work.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.work.po.Customer;
import com.neusoft.work.po.HealthManagerCustomer;
import com.neusoft.work.po.PageResponseBean;
import com.neusoft.work.po.ResponseBean;
import com.neusoft.work.service.HealthManagerCustomerService;


@RestController
@RequestMapping("/HealthManagerCustomerController")
public class HealthManagerCustomerController {

    @Autowired
    private HealthManagerCustomerService service;


    @PostMapping("/add")
    public ResponseBean<Integer> add(HealthManagerCustomer record) {
        return service.add(record);
    }


    @PostMapping("/removeAssignment")
    public ResponseBean<Integer> removeAssignment(
    	    @RequestParam Integer managerId,
    	    @RequestParam Integer customerId
    	) {
    	    return service.removeAssignment(managerId, customerId);
    	}
    
    
    @GetMapping("/queryNoManager")
    public PageResponseBean<List<Customer>> queryNoManager(
            @RequestParam(required = false) String name,
            @RequestParam(defaultValue = "1") Long cur,
            @RequestParam(defaultValue = "9999") Long number) {
        return service.queryNoManager(name, cur, number);
    }
    
    @GetMapping("/queryByManager")
    public ResponseBean<List<Map<String, Object>>> queryByManager(
            @RequestParam Integer managerId) {
        return service.queryByManager(managerId);
    }

}
